﻿/* 8. Write an expression that calculates trapezoid's area by given sides a and b and height h. */

using System;

public class TrapezoidArea
{
    public static void Main()
    {
        double a, b, h;
        double area;

        Console.Write("a = ");
        a = double.Parse(Console.ReadLine());
        Console.Write("b = ");
        b = double.Parse(Console.ReadLine());
        Console.Write("h = ");
        h = double.Parse(Console.ReadLine());

        if ((a >= 0) && (b >= 0) && (h >= 0))
        {
            area = (a + b) * h / 2;
            Console.WriteLine("Trapezoid's area = {0}", area);
        }
        else
            Console.WriteLine("Each of a, b and h must be nonnegative!");
    }
}